\(\int \frac {\cot (x)}{\cot (x)+\csc (x)} \, dx\) [206]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 10, antiderivative size = 12 \[ \int \frac {\cot (x)}{\cot (x)+\csc (x)} \, dx=x-\frac {\sin (x)}{1+\cos (x)} \]

[Out]

x-sin(x)/(1+cos(x))

Rubi [A] (verified)

Time = 0.07 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.300, Rules used = {4477, 2814, 2727} \[ \int \frac {\cot (x)}{\cot (x)+\csc (x)} \, dx=x-\frac {\sin (x)}{\cos (x)+1} \]

[In]

Int[Cot[x]/(Cot[x] + Csc[x]),x]

[Out]

x - Sin[x]/(1 + Cos[x])

Rule 2727

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> Simp[-Cos[c + d*x]/(d*(b + a*Sin[c + d*x])), x]
/; FreeQ[{a, b, c, d}, x] && EqQ[a^2 - b^2, 0]

Rule 2814

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*(x/d)
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rule 4477

Int[(cot[(c_.) + (d_.)*(x_)]^(n_.)*(a_.) + csc[(c_.) + (d_.)*(x_)]^(n_.)*(b_.))^(p_)*(u_.), x_Symbol] :> Int[A
ctivateTrig[u]*Csc[c + d*x]^(n*p)*(b + a*Cos[c + d*x]^n)^p, x] /; FreeQ[{a, b, c, d}, x] && IntegersQ[n, p]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\cos (x)}{1+\cos (x)} \, dx \\ & = x-\int \frac {1}{1+\cos (x)} \, dx \\ & = x-\frac {\sin (x)}{1+\cos (x)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 10, normalized size of antiderivative = 0.83 \[ \int \frac {\cot (x)}{\cot (x)+\csc (x)} \, dx=x-\tan \left (\frac {x}{2}\right ) \]

[In]

Integrate[Cot[x]/(Cot[x] + Csc[x]),x]

[Out]

x - Tan[x/2]

Maple [A] (verified)

Time = 0.23 (sec) , antiderivative size = 15, normalized size of antiderivative = 1.25

method result size
default \(-\tan \left (\frac {x}{2}\right )+2 \arctan \left (\tan \left (\frac {x}{2}\right )\right )\) \(15\)
risch \(x -\frac {2 i}{{\mathrm e}^{i x}+1}\) \(15\)

[In]

int(cot(x)/(cot(x)+csc(x)),x,method=_RETURNVERBOSE)

[Out]

-tan(1/2*x)+2*arctan(tan(1/2*x))

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.42 \[ \int \frac {\cot (x)}{\cot (x)+\csc (x)} \, dx=\frac {x \cos \left (x\right ) + x - \sin \left (x\right )}{\cos \left (x\right ) + 1} \]

[In]

integrate(cot(x)/(cot(x)+csc(x)),x, algorithm="fricas")

[Out]

(x*cos(x) + x - sin(x))/(cos(x) + 1)

Sympy [F]

\[ \int \frac {\cot (x)}{\cot (x)+\csc (x)} \, dx=\int \frac {\cot {\left (x \right )}}{\cot {\left (x \right )} + \csc {\left (x \right )}}\, dx \]

[In]

integrate(cot(x)/(cot(x)+csc(x)),x)

[Out]

Integral(cot(x)/(cot(x) + csc(x)), x)

Maxima [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.92 \[ \int \frac {\cot (x)}{\cot (x)+\csc (x)} \, dx=-\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1} + 2 \, \arctan \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right ) \]

[In]

integrate(cot(x)/(cot(x)+csc(x)),x, algorithm="maxima")

[Out]

-sin(x)/(cos(x) + 1) + 2*arctan(sin(x)/(cos(x) + 1))

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 8, normalized size of antiderivative = 0.67 \[ \int \frac {\cot (x)}{\cot (x)+\csc (x)} \, dx=x - \tan \left (\frac {1}{2} \, x\right ) \]

[In]

integrate(cot(x)/(cot(x)+csc(x)),x, algorithm="giac")

[Out]

x - tan(1/2*x)

Mupad [B] (verification not implemented)

Time = 23.24 (sec) , antiderivative size = 8, normalized size of antiderivative = 0.67 \[ \int \frac {\cot (x)}{\cot (x)+\csc (x)} \, dx=x-\mathrm {tan}\left (\frac {x}{2}\right ) \]

[In]

int(cot(x)/(cot(x) + 1/sin(x)),x)

[Out]

x - tan(x/2)